<template>
  <view>
    <u-tabs :list="list1" @click="click"></u-tabs>
      <view class="box" v-for="(item, index) in list2" :key="index">
    <navigator :url="'/subpkg/Task-detail/Task-detail?id=' + item.id">
        <view class="line">
          <view class="box_top">
            <view class="box_top-c">任务编号：{{ item.transportTaskId }}</view>
            <u-tag text="已延迟" plain type="error" shape="circle"></u-tag>
          </view>
          <view class="box_cen">
            <view class="box_cen_t">
              <view class="line-box">
                <view class="box_cen_t-c">起</view>
                <u-line style="margin-left:8px ;" direction="col" dashed></u-line>
              </view>
            </view>
            <view class="box_cen_c">{{ item.startAddress }}</view>
          </view>
          <view class="xia">
            <view class="xia-l"><view class="xia-l-b">终</view></view>
            <view class="xia-b">{{ item.endAddress }}</view>
          </view>
        </view>

        <!-- 线]框下面 -->
        <view class="bot">
          <view class="bot_left">
            <view class="bot_left-c">提货时间</view>
            <view class="bot_left_time">{{ item.created }}</view>
          </view>

          <!-- 右边 -->
          <view class="bot_right"><button class="btn">提货</button></view>
        </view>
        </navigator>
      </view>
    
    <navigator url="../login/login"><button>点击</button></navigator>
  </view>
</template>

<script>
export default {
  name: 'indexPage',
  components: {},
  data() {
    return {
      list1: [
        {
          name: '待提货'
        },
        {
          name: '在途'
        },
        {
          name: '已完成'
        }
      ],
      list2: [],
      status: '1',
      page: '1',
      pageSize: '10'
    };
  },
  async created() {
    let {
      data: {
        data: { items }
      }
    } = await uni.$http.get('/tasks/list', {
      // this.status:status ,
      // this.page:page,
      // this.pageSize:pageSize
      status: this.status,
      page: this.page,
      pageSize: this.pageSize
    });
    console.log(items);
    this.list2 = items;
    console.log(items.id)
  },
  mounted() {},
  onLoad() {},
  methods: {
    click(item) {
      console.log('item', item);
    }
  }
};
</script>

<style lang="scss">
.box {
  overflow: hidden;
  width: 345px;
  height: 229px;
  margin: 15px;
  background-color: #fff;
  border-radius: 10px;
  padding:0 10px;
  .line {
    height: 150px;
    border-bottom: 1px solid #eeeeee;
  }
  u-line {
    position: absolute;
    top: 0;
  }
  .box_top {
    display: flex;
    // width: 375px;
    // height: 22px;
    margin: 15px 0;
  }
  .box_top-c {
    width: 284px;
    height: 22px;
    font-size: 16px;
  }
  .box_top_r {
    width: 60px;
    height: 22px;
    text-align: center;
    line-height: 22px;
    font-size: 14px;
    margin-left: 70px;
  }
}
.box_cen {
  display: flex;
  height: 40px;
  margin-bottom: 14px;

  .box_cen_t {
    // display: flex;
    height: 40px;
    position: relative;
  }
  .box_cen_t-c {
    width: 22px;
    height: 22px;
    background-color: #2a2929;
    border-radius: 50%;
    text-align: center;
    color: #fff;
    line-height: 22px;
    font-size: 12px;
  }
  .box_cen_c {
    width: 275px;
    height: 40px;
    font-size: 14px;
    margin-left: 12px;
    color: #818181;
  }
}
.xia {
  display: flex;
  height: 40px;
  margin-top: 20px;
}
.xia-b {
  font-size: 14px;
  color: #818181;
}
.xia-l {
  .xia-l-b {
    text-align: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: red;
    margin-right: 11.5px;
    color: #fff;
    font-size: 12px;
  }
}

page {
  background-color: #f4f4f4;
}

.bot {
  display: flex;
}
.bot_left {
  width: 174px;
  height: 40px;
  margin-top: 5px;
  .bot_left-c {
    font-size: 14px;
    color: #818181;
  }
}
.bot_right {
  .btn {
    width: 80px;
    height: 32px;
    line-height: 32px;
    font-size: 16px;
    background-color: #ef4f3f;
    border-radius: 30px;
    margin: 16px 0 0 60px;
    color: #fff;
  }
}
::v-deep {
  .u-tabs {
    background-color: #fff;
  }
  .line_tt {
    // position: absolute;
  }
}
</style>
